# Summary: Creates Appendix A

######################################################
#-------------------Appendix A ----------------------#
######################################################

options(scipen=999)
rm(list = ls())

# Set WD
# setwd('~/Dataverse')

# Load data
load("./Data/loyalty_cases.RData")

n_TREcases_centralized_2008 = loyalty_cases$n_cases_year_by_type[loyalty_cases$centralized==1]
n_eleitos_centralized_2008 = loyalty_cases$n_eleitos_year_by_type[loyalty_cases$centralized==1]

n_TREcases_decentralized_2008 = loyalty_cases$n_cases_year_by_type[loyalty_cases$centralized==0]
n_eleitos_decentralized_2008 = loyalty_cases$n_eleitos_year_by_type[loyalty_cases$centralized==0]

sink("./AppendixAResults/diffMeans_loyalty.txt")
prop.test(x = c(n_TREcases_centralized_2008, n_TREcases_decentralized_2008), n = c(n_eleitos_centralized_2008, n_eleitos_decentralized_2008))
sink()
